Page({
  data: {
    items:[]
    
  },
  onLoad(query) {
    var order_id = query.order_id;
    if(order_id == '' || order_id == undefined){
      order_id = '864690e0-2684-11e8-aacd-6c0b8481e2be';
    }
    this.init(order_id);
  },
  async init(order_id){
    var app = getApp();
      var url = app.globadData.apiUrlHeader+'get-order-goods';
      var json = {"access_token":app.globadData.access_token,"order_id":order_id};
      console.log(json);
      my.httpRequest({
      url: url, // 目标服务器 url
      method:'Post',
      headers:{'Content-Type':'Application/json'},
      data:JSON.stringify(json),
        dataType:'json',
        success: (res) => {
          console.log(res);
        if(res.data.status==0)
        {
          console.log(res);
          //  img = res.data.data;
          // console.log(img);
          this.setData({
          //  items : img
           items : res.data.data
          });
        }
      },
    });

     var i = await app.getUserInfo();
     app.globadData.userInfo.nickName = i.data.nickName;
      console.log('3');
      app.globadData.userInfo.avatar = i.data.avatar;
      var j = await app.login(i.data.auth_code);
      console.log(j);
      app.globadData.access_token = j;
    
  },
});
